<?php
require_once '../../include/common.inc.php';
if($cfg['config']['loginguest']=='0')header('location:../../logging.php');
require_once PPCHAT_ROOT.'./include/json.php';
$json=new JSON_obj;
//游客登录
if(!isset($_SESSION['login_uid']) and $cfg['config']['loginguest']=="1"){gusetLogin();}
//房间状态
if($cfg['config']['state']=='2' and $_SESSION['room_'.$cfg['config']['id']]!=true){header("location:../login.php?1");exit();}
if($cfg['config']['state']=='0'){exit("<script>location.href='../error.php?msg=系统处于关闭状态！请稍候……'</script>");exit();}
//是否登录
if(!isset($_SESSION['login_uid'])){header("location:../../logging.php");exit();}

//用户信息
$uid=$_SESSION['login_uid'];
$db->query("update {$tablepre}members set regip='$onlineip' where uid='{$uid}'");
$userinfo=$db->fetch_row($db->query("select m.*,ms.* from {$tablepre}members m,{$tablepre}memberfields ms  where m.uid=ms.uid and m.uid='{$uid}'")); 
$_SESSION['login_gid']=$userinfo['gid'];
//游客
if($_SESSION['login_uid']==0){$userinfo['username']=$userinfo['nickname']=$_SESSION['login_nick'];$userinfo['sex']=$_SESSION['login_sex'];$userinfo['uid']=$_SESSION['login_guest_uid'];}

//黑名单
$query=$db->query("select * from {$tablepre}ban where (username='{$userinfo[username]}' or ip='{$onlineip}') and losttime>".gdate()." limit 1");
while($row=$db->fetch_row($query)){
	exit("<script>location.href='error.php?msg=用户名或IP受限！过期时间".date("Y-m-d H:i:s",$row['losttime'])."'</script>");exit();
}




//用户组
$query=$db->query("select * from {$tablepre}auth_group order by ov desc");
while($row=$db->fetch_row($query)){
	$groupli.="<div id='group_{$row[id]}'></div>";
	$grouparr.="grouparr['{$row[id]}']=".json_encode($row).";\n";
	$group["m".$row[id]]=$row;
}
//聊天历史记录
$query=$db->query("select * from {$tablepre}msgs where rid='".$cfg['config']['id']."' and p='false' and state!='1' and `type`='0' order by id desc limit 0,20 ");

while($row=$db->fetch_row($query)){
	$row['msg']=str_replace(array('&amp;', '','&quot;', '&lt;', '&gt;'), array('&', "\'",'"', '<', '>'),$row['msg']);
	if($row[tuid]!="ALL"){
		$omsg="<div class='msg' id='{$row[msgid]}'><div class='msg_head'><img src='../../face/img.php?t=p1&u={$row[uid]}'><span class='u'>{$row[uname]}</span><span class='dui'>对</span><img src='../../face/img.php?t=p1&u={$row[tuid]}'><span class='u'>{$row[tname]}</span><span class='shuo'>说</span></div>
		 <div class='msg_content'>{$row[msg]}</div></div>".$omsg;
	}
	else{
		$omsg="<div class='msg_li'><div style='clear:both;'></div><div class='msg' id='{$row[msgid]}'><div class='msg_head'><img src='../../face/img.php?t=p1&u={$row[uid]}'><span class='u'> {$row[uname]}：</spa></div> <div class='msg_content'>{$row[msg]}</div></div></div>".$omsg;
	}
}
//获取最大ID
$query=$db->query("select max(id+0) max_id from {$tablepre}msgs");
	$row=$db->fetch_row($query);

$_SESSION['max_msg_id']=$row['max_id'];
//其他处理
$ts=explode(':',$cfg['config']['tserver']);


if(!isset($_SESSION['room_'.$uid.'_'.$cfg['config'][id]])){
$db->query("insert into  {$tablepre}msgs(rid,ugid,uid,uname,tuid,tname,mtime,ip,msg,`type`)values('{$cfg[config][id]}','{$userinfo[gid]}','{$userinfo[uid]}','{$userinfo[username]}','{$cfg[config][defvideo]}','{$cfg[config][defvideonick]}','".gdate()."','{$onlineip}','登陆直播间','3')");
$db->query("update {$tablepre}memberfields set logins=logins+1 where uid='{$uid}'");	
$_SESSION['room_'.$uid.'_'.$cfg['config'][id]]=1;
}	
?>


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
<title>
<?=$cfg['config']['title']?>
</title>
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="default">
<meta name="browsermode" content="application">
<meta name="apple-touch-fullscreen" content="no">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<script src="script/flexible.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="<?=$cfg['config']['ico']?>" />
<link rel="stylesheet" href="./css/index.min.css">
<script src="script/jquery.min.js"></script>
<script src="script/json3.min.js"></script>
<script src="script/socket.io.js"></script>
<!--<script src="script/WebSocket.js"></script>-->
<script src="script/jquery.nicescroll.min.js"></script>
<script src="script/main.m.js"></script>
<script src="script/layer.m-1.7.js"></script>
<script src="../script/device.min.js"></script>
<script>
if (!device.mobile()){window.location = '../';}
globalgid = <?=$cfg['config']['id']?>;
des_msg = <?=$cfg['config']['des_msg']?>;
is_login = <?=$_SESSION['login_uid']?>;

var UserList;
var ToUser;
var VideoLoaded=false;
var My={dm:'<?=$_SERVER['HTTP_HOST']?>',rid:'<?=$cfg['config']['id']?>',roomid:'<?=$_SERVER['HTTP_HOST']?>/<?=$cfg['config']['id']?>',chatid:'<?=$userinfo['uid']?>',name:'<?=$userinfo['username']?>',nick:'<?=$userinfo['nickname']?>',sex:'<?=$userinfo['sex']?>',age:'0',qx:'<?=check_auth('room_admin')?'1':'0'?>',ip:'<?=$onlineip?>',vip:'<?=$userinfo['gid']?>',color:'<?=$userinfo['gid']?>',cam:'0',state:'0',mood:'<?=$userinfo['mood']?>',rst:'<?=$time?>',camState:'1',key:'<?=connectkey()?>'}

var RoomInfo={loginTip:'<?=$cfg['config']['logintip']?>',Msglog:'<?=$cfg['config']['msglog']?>',msgBlock:'<?=$cfg['config']['msgblock']?>',msgAudit:'<?=$cfg['config']['msgaudit']?>',defaultTitle:document.title,MaxVideo:'10',VServer:'<?=$cfg['config']['vserver']?>',VideoQ:'',TServer:'<?=$ts[0]?>',TSPort:'<?=$ts[1]?>',PVideo:'<?=$cfg['config']['defvideo']?>',AutoPublicVideo:'1',AutoSelfVideo:'0',type:'1',PVideoNick:'',OtherVideoAutoPlayer:'<?=$cfg['config']['livetype']?>',r:'<?=$cfg['config']['rebots']?>'}
var grouparr=new Array();
<?=$grouparr?>
var ReLoad;
var isIE=document.all;
var aSex=['<span class="sex-womon"></span>','<span class="sex-man"></span>',''];
var aColor=['#FFF','#FFF','#FFF'];
var msg_unallowable="<?=$cfg['config']['msgban']?>";
//setInterval("getmsg()",3000);
wordpreUrl ='<?=$wpbaseurl.'/func/public/waplive?token='.$_SESSION['access_token']?>';

</script>
<style type="text/css" media="screen">
#flashContent { display: block; text-align: left; }
</style>
</head>
<body style="position: relative; top: 0px; background-image: url(./images/929199.jpg); background-size: cover; overflow: hidden; background-position: initial initial; background-repeat: no-repeat no-repeat;">
<?php
//禁言
$query=$db->query("select * from {$tablepre}send where (username='{$userinfo[username]}' or ip='{$onlineip}') limit 1");
while($row=$db->fetch_row($query)){
	echo "<script>remove_auth('msg_send');</script>";
}
?>
<div id="details"></div>
<div id="newsDetail" style="display: none;"></div>
<div class="zhezhao"></div>
<div id="sharedWrap"> </div>
<div id="shared"></div>
<article>
  <div id="logo"> <img src="<?=$cfg['config']['logo']?>" alt="" width="80px" height="25px"> </div>
  <section id="head_1">
    <div id="video-flash" class="videoTitle"> <img src="./images/refresh.png" alt="刷新" width="20px" height="20px">
      <div class="video-flashBtn">刷新视频</div>
    </div>
    <!-- 视频 -->
    <div class="video-box">
      <div class="video-wrap">
        <div class="bg-opacity"></div>
      </div>
      <div class="video-wrap" id="view-wrap-container">
        <div id="video-status-container" class="video-status-container"></div>
        <div class="video-win" id="video-win">
        </div>
      </div>
    </div>
    <!-- <div class="ad_kong" style="width: 100%; height: 25px;visibility: hidden;">
      
    </div> -->
	<!-- <marquee scrollamount="3" style="width: 100%; height: 25px; line-height: 25px; background-color: #CCC;">
<?php
//			$query=$db->query("select * from {$tablepre}msgs where  rid='".$cfg['config']['id']."' and state='2' and type='0' order by id desc limit 1");
//			while($row=$db->fetch_row($query)){
//				echo "<span style='color:#FF0'>".tohtml($row[msg])."</span>";
//			}
		?>
</marquee> -->
    <nav>
      <ul>
        <li class="spec1 active">聊天<span class="activeCart0"></span> </li>
        <li class="spec2">客服<span class=""></span> </li>
        <li class="spec3">文字直播<span class=""></span> </li>
        <li class="spec4">名师<span class=""></span> </li>
          <li style="">
              <?php
              if($_SESSION['login_uid']>0)
              {
                  echo " <a href='../../logging.php?act=logout'>退出登陆</a>";
              }else {
                  echo '<div id="loginBtn" onClick="location.href=\'../m/minilogin.php\'">注册/登陆</div>';
              }
              ?>

          </li>
      </ul>
    </nav>
  </section>
  <section id='m_tab'>
    <div id="publicChat" class="publicChat"><?=$omsg?></div>
    <div id="qqOnline" style="width: 100%; display: none;" class="white">
      <!-- <iframe src="/apps/kefu.m.php" frameborder="0" scrolling-y="auto" width="99.9999%" height="100%"></iframe> -->


<?php
//    $query=$db->query("select m.*,ms.* from {$tablepre}members m,{$tablepre}memberfields ms  where m.uid=ms.uid and m.gid=3 ");
//    $i = 0;
//    while($row=$db->fetch_row($query)){
//        ++$i;
//        $list.="
//
//      <div class='li'>
//        <div class='li_qq'><a href='mqqwpa://im/chat?chat_type=wpa&uin={$row[realname]}&version=1&src_type=web&web_src=oicqzone.com'   target='oqq'>
//        {$row[nickname]}</a></div>
//        <div class='li_phone'>{$row[phone]}</div>
//      </div>
//    ";
//    }
?>
      <div class='list' id="qqlist">
<!--          --><?//=$list?>
      </div>
    </div>
<style type="text/css"> 
    #qqOnline{
        overflow-y: auto;
    }
    #qqOnline .list { float: left;width: 100%; margin-bottom:20px;}
    #qqOnline .li{ float: left; margin:3px; width: 48%; padding: 1px; border: 1px solid #aec5d8; background-color: #fff; height:auto;box-sizing: border-box;}
    #qqOnline .li_img{
        text-align: center;
    }
    #qqOnline .li_img img{ width:100px; height: 140px; border: 1px #CCCCCC solid;margin-top: 4px;}
    #qqOnline .li_qq { background: url(/apps/img/pop_btn1.png) no-repeat; display: block; margin: 0 auto; color: #fff; font-size: 14px; margin-top: 3px;padding-left: 25px; width: 105px; height: 27px; line-height: 27px; overflow:hidden; }
    #qqOnline .li_qq>a{color: #fff;}
    #qqOnline .li_qq:hover{opacity: 0.9;}
    #qqOnline .li_phone { background: url(/apps/img/pop_btn2.png) no-repeat 1px 3px; display: block; height: 22px; line-height: 22px; padding-left: 12px; width: 90px; margin: 0 auto; font-size: 13px;  overflow:hidden; color:#F00;}
    #qqOnline .li_phone a{ color:red;}
</style>

    <div class="kuaiXun" style="width: 100%;height: 100%; display: none;">
      <!-- <iframe src="--><?//=$worpressurl?><!--" frameborder="0" scrolling-y="auto" width="99.9999%"  height="500"></iframe> -->
      <!-- <object type="text/x-scriptlet" data="<?//=$wpbaseurl.'/func/public/waplive?token='.$uid=$_SESSION['access_token']?>" scrolling-y="auto" height='100%' width="99.9999%"></object> -->
    </div>

    
    <div class="Teacher" style="width: 100%;height: 100%; display: none;"> 
        <Ul>
            <?php
            $query=$db->query("select * from {$tablepre}lecturer where  roomid='".$cfg['config']['id']."' and is_show='1'  order by ord asc ");
            while($row=$db->fetch_row($query)){
                $row[remark] = strip_tags($row[remark], '<br>');
            ?>

              <li>
                  <div class="t_msg clearfix">
                      <div class="t_rw">
                          <img src="<?=$row[ico]?>" alt="" />
                      </div>
                      <div class="t_ind">
                          <p class="name"><strong><?=$row[name]?></strong></p>
                          <p class="hot">
                            <lable class='re_t'><img src="images/rq_t.png" alt="" /></lable><span class='rq_num'><?=$row[roomview]?></span>
                            <lable class='bf_t'><img src="images/bf_t.png" alt="" /></lable><span class='bf_num'><?=$row[videonum]?></span>
                          </p>
                      </div>
                  </div>
                  <div class="t_details" style="text-indent: 2em">
                      <?=$row[remark]?>
                  </div>
              </li>
            <?php  }  ?>
<!--          <li>-->
<!--              <div class="t_msg clearfix">-->
<!--                  <div class="t_rw">-->
<!--                      <img src="images/xq_t.png" alt="" />-->
<!--                  </div>-->
<!--                  <div class="t_ind">-->
<!--                      <p class="name"><strong>夏青</strong></p>-->
<!--                      <p class="hot">-->
<!--                        <lable class='re_t'><img src="images/rq_t.png" alt="" /></lable><span class='rq_num'>43698</span>-->
<!--                        <lable class='bf_t'><img src="images/bf_t.png" alt="" /></lable><span class='bf_num'>12</span>-->
<!--                      </p>-->
<!--                  </div>-->
<!--              </div>-->
<!--              <div class="t_details">-->
<!--                <p>某知名证券咨询公司十多年首席投顾分析师，私募基金投资经理，某慈善基金会特聘投资顾问，著名财经学校特聘讲师。操盘手起家，实战派人士，对资金的趋势性和搏弈带来的机会有敏锐的感觉，善于掌握交易性投资机会。</p>-->
<!--                <p>历经Ａ股多轮的牛熊转换，形成了其独特的操盘秘籍<strong>《猎庄黄金战法》《仓位九段法》</strong>等，并多次在权威财经媒体或公开报告会发表！</p>-->
<!--              </div>-->
<!--          </li>-->
<!--          <li>-->
<!--              <div class="t_msg clearfix">-->
<!--                  <div class="t_rw">-->
<!--                      <img src="images/hqb_t.png" alt="" />-->
<!--                  </div>-->
<!--                  <div class="t_ind">-->
<!--                      <p class="name"><strong>何庆彬</strong></p>-->
<!--                      <p class="hot">-->
<!--                        <lable class='re_t'><img src="images/rq_t.png" alt="" /></lable><span class='rq_num'>38794</span>-->
<!--                        <lable class='bf_t'><img src="images/bf_t.png" alt="" /></lable><span class='bf_num'>11</span>-->
<!--                      </p>-->
<!--                  </div>-->
<!--              </div>-->
<!--              <div class="t_details">-->
<!--                <p>具有专业扎实的金融基础，拥有证监会的认证资格。多年就职于国内顶级操盘机构。</p>-->
<!--                <p>多次受邀主讲光大证券、银河证券等多家知名券商的大客户投资分享会，原创投资分析报告多次被多次被国内券商采纳。擅长技术分析，投资风格激进不失稳健。</p>-->
<!--              </div>-->
<!--          </li>-->
<!--          <li>-->
<!--              <div class="t_msg clearfix">-->
<!--                  <div class="t_rw">-->
<!--                      <img src="images/wyf_t.png" alt="" />-->
<!--                  </div>-->
<!--                  <div class="t_ind">-->
<!--                      <p class="name"><strong>巫燕峰</strong></p>-->
<!--                      <p class="hot">-->
<!--                        <lable class='re_t'><img src="images/rq_t.png" alt="" /></lable><span class='rq_num'>35675</span>-->
<!--                        <lable class='bf_t'><img src="images/bf_t.png" alt="" /></lable><span class='bf_num'>16</span>-->
<!--                      </p>-->
<!--                  </div>-->
<!--              </div>-->
<!--              <div class="t_details">-->
<!--                <p>于2007年9月加入某基金管理有限公司,先后担任过策略分析师、债券分析师。</p>-->
<!--                <p>潜心研究股票多年，擅长基本面分析，实地调研过多家上市公司，拥有多年实战经验。形成基本面选股，技术面择时的操作风格。敬畏市场，只做有把握的投资，注重控制风险，实现长期稳定盈利。</p>-->
<!--              </div>-->
<!--          </li>-->
<!--          <li>-->
<!--              <div class="t_msg clearfix">-->
<!--                  <div class="t_rw">-->
<!--                      <img src="images/csy_t.png" alt="" />-->
<!--                  </div>-->
<!--                  <div class="t_ind">-->
<!--                      <p class="name"><strong>陈世玉</strong></p>-->
<!--                      <p class="hot">-->
<!--                        <lable class='re_t'><img src="images/rq_t.png" alt="" /></lable><span class='rq_num'>25897</span>-->
<!--                        <lable class='bf_t'><img src="images/bf_t.png" alt="" /></lable><span class='bf_num'>9</span>-->
<!--                      </p>-->
<!--                  </div>-->
<!--              </div>-->
<!--              <div class="t_details">-->
<!--                <p>-->
<!--                  具有超过11年的股票研究经验。拥有丰富的大资金运作经验，战绩卓著，曾就职于某著名证券公司研发中心。深谙中国股市，在市场和政策深度分析方面视角独特。在机会把握上擅长准确把握市场运行节奏，注重在投资上的提前动作，充分地分享资本市场每个阶段的投资主题带来的机会；善于解析国内政策，及时捕捉市场热点板块龙头股。-->
<!--                </p>-->
<!--              </div>-->
<!--          </li>-->
<!--          <li>-->
<!--              <div class="t_msg clearfix">-->
<!--                  <div class="t_rw">-->
<!--                      <img src="images/wyb_t.png" alt="" />-->
<!--                  </div>-->
<!--                  <div class="t_ind">-->
<!--                      <p class="name"><strong>王艳兵</strong></p>-->
<!--                      <p class="hot">-->
<!--                        <lable class='re_t'><img src="images/rq_t.png" alt="" /></lable><span class='rq_num'>39685</span>-->
<!--                        <lable class='bf_t'><img src="images/bf_t.png" alt="" /></lable><span class='bf_num'>12</span>-->
<!--                      </p>-->
<!--                  </div>-->
<!--              </div>-->
<!--              <div class="t_details">-->
<!--                <p>-->
<!--                  曾经担任私募基金公司首席操盘手，熟悉和从事过股票、期货、期权、外汇、港股、美股等资本市场的投资，全心研究金融市场9年，从事股市实盘操作8年，擅长基本面、技术面、资金面结合分析，操作手法彪悍，操作风格中短结合，拥有自创的分析系统和交易系统加资金管理方法。具有稳、准、狠的操盘特点。-->
<!--                </p>-->
<!--              </div>-->
<!--          </li>-->
        </Ul>
    </div>
  </section>
</article>
<div id="footer" style="">
  <div class="sendBtn fr" id="sendBtn">发送</div>
  <div id="sharedBtn"> <span>分享</span> </div>
  <div class="smile"> <img src="./images/smile.png" alt="表情" width="26px" height="26px"> </div>
  <div id="editor">
    <div class="messageEditor" id="messageEditor" contenteditable="true"></div>
  </div>
</div>
<div class="loginWrap"></div>
<div class="tipMesWrap"></div>
<div class="setting-expression-layer" style='display: none;'>
  <div class="expression" id="expressions">
    <table class="expr-tab expr-tab1">
    </table>
  </div>
</div>
<script>OnInit();</script>

<!-- 判断是否登录弹窗 -->
<div class="m_popup">
  <div class="m_dark"></div>
  <div class="m_login_tip">
    <h3>温馨提示</h3>
    <div class="m_lt">
        您现在没有权限发表言论，请先登录账号或注册!
    </div>
    <button class="m_sure">确定</button>
  </div>
</div>

<!-- 分享板块 -->
<div class="share-box">
        <!--遮罩-->
        <div class="fixed" style="display: block;"></div>
        <!-- 分享 -->
        <div class="share-item" style="display: block;">
            <div class="si-title"><label>分享到</label></div>
            <div class="si-type clearfix">
                <div class="bdsharebuttonbox bdshare-button-style1-32 clearfix" data-bd-bind="1482976074371">
                    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博">
                        <img src="http://wordpress.gdgccj.com/func/public/wapstatic/images/share/share-icon-05.jpg">
                        <p>新浪微博</p>
                    </a>
                    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友">
                        <img src="http://wordpress.gdgccj.com/func/public/wapstatic/images/share/share-icon-03.jpg">
                        <p>QQ好友</p>
                    </a>
                    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间">
                        <img src="http://wordpress.gdgccj.com/func/public/wapstatic/images/share/share-icon-04.jpg">
                        <p>QQ空间</p>
                    </a>
                </div>
            </div>
            <div class="si-operate"><a>取消</a></div>
        </div>
    </div>
</body>
</html>
<!-- 分享js开始 -->
<script>
    window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"分享到新浪微博","bdMini":"1","bdMiniList":["bdxc","tqf","douban","bdhome","sqq","thx","ibaidu","meilishuo","mogujie","diandian","huaban","duitang","hx","fx","youdao","sdo","qingbiji","people","xinhua","mail","isohu","yaolan","wealink","ty","iguba","fbook","twi","linkedin","h163","evernotecn","copy","print"],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
<script type="text/javascript">
    $(".share-item .si-operate a").click(function(){
        $('.share-box').hide();
    });
    $("#sharedBtn").click(function(e) {
        e.stopPropagation();
        $('.share-box').show();
    });
    $(document).bind('click',function(e){
        var target = $(e.target);
        // target.closest('.share-item').length  返回的是0和1
        if(target.closest('.share-item').length == 0){
            $('.share-box').hide();
        }
    })
</script>
<!-- 分享js结束 -->

<script>
    $.ajax({
        url: 'http://actapi.gdgccj.com/html/app/gcjmnxqbII/common/get_qq.php?total=6',
        type: 'get',
        cache: false,
        dataType: "jsonp",
        jsonp:"callback",
        success: function(json) {
            var layer_html = '';
            $.each(json.qq,function(index, value){
                layer_html+="<div class='li'>  <div class='li_qq'><a href='mqqwpa://im/chat?chat_type=wpa&uin="+value+"&version=1&src_type=web&web_src=oicqzone.com'   target='oqq'>";
                layer_html+= value+"</a></div><div class='li_phone'>"+json.phone[index]+"</div> </div>"
              });
            $('#qqlist').html(layer_html);
        }
    });
</script>